gen pid = pid1
replace pid = 1 if (pid4==2)
replace pid = 2 if (pid4==1)
label define party 1 democrat 2 republican 3 independent 4 other
label values pid party

gen mus_treat = mus_accept
replace mus_treat = 2 if (muslim_rej == 1)
replace mus_treat = 0 if (mus_treat ==.)
bysort mus_treat: tab pid muslim, row

gen sept_treat = sept_acc
replace sept_treat = 2 if (sept_rej == 1)
replace sept_treat = 0 if (sept_treat ==.)
bysort sept_treat: tab pid sept11_0, row
